package SoftwarePrinciple.LiskovSubstitutionPrinciple;

/**
 * @author: Themberfue
 * @date: 2025/8/7 11:36
 * @description:
 */
// 客户端代码
public class Client {
    // 该方法可以处理任何实现了Shape接口的对象
    public static void printArea(Shape shape) {
        System.out.println("面积: " + shape.calculateArea());
    }

    public static void main(String[] args) {
        Shape rectangle = new RectangleShape(5, 10);
        Shape square = new SquareShape(5);

        printArea(rectangle);  // 正确输出: 面积: 50
        printArea(square);     // 正确输出: 面积: 25
    }
}
